/* Exercice 5.38
   ejer5_38.c */
#include <stdio.h>

long factorial(long number);

/* function main begins program execution */
int main( void )
{
    long n;

    printf("Enter a number: ");
    scanf("%ld", &n);
    printf("The factorial is: %ld\n", factorial(n));
    return 0; /* indicate that program ended successfully */
} /* end function main */

long factorial(long number)
{
    int c;

    for(c = 1; c < number; c++)
        printf("\t");
    printf("Number: %ld\n", number);
    if (number <= 1)
        return 1;
    else
        return number * factorial(number - 1);
}
